function errorPageSetup() {
	
	var viewLink = document.getElementById("viewStackTrace");
	if(viewLink) {
	
		viewLink.onclick=toggleStackTraceVisibility;
		if (viewLink.captureEvents) 
			viewLink.captureEvents(Event.CLICK);
	}	
}
registerStartupFunction( errorPageSetup );

function toggleStackTraceVisibility(evt) {
	var stackTrace = document.getElementById("stackTrace");
	var viewLink = document.getElementById("viewStackTrace");
	
	if(stackTrace && viewLink) {
		if(stackTrace.style.display == "block") {
			
			stackTrace.style.display = "none";
			var linkText = (new String(viewLink.firstChild.nodeValue)).replace("Hide", "Show");
			viewLink.removeChild( viewLink.firstChild );
			viewLink.appendChild(document.createTextNode( linkText ));
		} else {
			
			stackTrace.style.display = "block";
			var linkText = (new String(viewLink.firstChild.nodeValue)).replace("Show", "Hide");
			viewLink.removeChild( viewLink.firstChild );
			viewLink.appendChild(document.createTextNode( linkText ));
		}
	}
	return false;
}